<%-- 
    Document   : reportCommonHeader
    Created on : 13 Dec, 2012, 8:43:03 PM
    Author     : sagar
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%@include file="../common/script.jsp" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <%@include file="../common/header.jsp" %>
        <%@include file="../common/title.jsp" %>
        <script type="text/javaScript">
            var rules=new Array();
            rules[0]='startDate|required|please enter startDate'; 
            rules[1]='stopDate|required|please enter stopDate'; 
            rules[2]='callTypeId|required|please select callType'; 
            rules[3]='dispositionId|required|please select disposition'; 
             //FOR DISPOSITION LIST
            function showDispositionList(){
                var callTypeId=document.getElementById("callTypeId").value;
                $.ajax({
                    data: ({'callTypeId1' : callTypeId}),
                    url: "../ajaxCallForDispositionList.htm",
                    dataType: "json",
                    success:function(json){
                        var i=0;
                        document.getElementById("dispositionId").length=0;
                        
                        var anOption1=document.createElement("OPTION");
                        document.form1.dispositionId.options.add(anOption1);
                        anOption1.text="-";
                        anOption1.value="";
                        for(i=0;i<json.length;i++){
                            //alert('inside if ');
                            var anOption=document.createElement("OPTION");
                            document.form1.dispositionId.options.add(anOption);
                            //alert('anOption.text: '+anOption.text);
                            anOption.text=json[i].label;
                            anOption.value=json[i].value;
                        }
                    },
                    error: function(e){
                        
                        alert("Error:  method not called ");
                    }
                });
            }
            //End
        
        </script>

    </head>
    <body onLoad="yav.init('form1',rules,'inline');">
        <%@include file="../common/menu.jsp" %>
        <%@include file="../common/message.jsp" %>
        <script type="text/javascript">
            $(function() {
                $( "#startDate" ).datepicker({dateFormat: 'yy-mm-dd'});
                $( "#stopDate" ).datepicker({dateFormat: 'yy-mm-dd'});
            });
        </script>

        <div class="in_02">
            <fieldset>
                <legend>Report</legend>
                <form method="POST" id="form1" name="form1" action="callLogReports.htm">

                    <table class="formTable">
                        <tr>
                            <td style="padding:5px 30px 1px 5px;">Start date:<br/>
                                <input name="startDate" id="startDate" value="${startDate}" class="userInputMedium"/>
                                <span id="errorsDiv_startDate" ></span></td>
                            <td style="padding:5px 30px 1px 5px;">Stop date:<br/>
                                <input  name="stopDate"  id="stopDate" value="${stopDate}" class="userInputMedium" />
                                <br/><span id="errorsDiv_stopDate"></span></td>
                            <td style="padding:5px 30px 1px 5px;"><spring:message code="callType"/>:<br/>
                                <select  name="callTypeId" id="callTypeId" class="userInputMedium" onchange="showDispositionList();">
                                    <option value="0">-</option>
                                    <c:forEach items="${callTypeList}" var="callTypeItem">
                                        <option <c:if test="${callTypeId==callTypeItem.callTypeId}">selected</c:if> value="${callTypeItem.callTypeId}">${callTypeItem.callTypeName}</option>
                                    </c:forEach>
                                </select><br/><span id="errorsDiv_callTypeId"></span>
                            </td>
                            <td style="padding:5px 30px 1px 5px;"><spring:message code="disposition"/>:<br/>
                                <select  name="dispositionId" id="dispositionId" class="userInputLarge" >
<!--                                    <option value="0">All</option>-->
                                        <option selected value="${dispositionId}">${dispositionName}</option>
                                </select><br/><span id="errorsDiv_dispositionId"></span>
                            </td>
                            <td><spring:message code="doctorName"/>:<br/> 
                                <select  name="doctorId"  id="doctorId" class="userInputLarge">
                                    <option value="0">All</option>
                                    <c:forEach items="${doctorList}" var="doctorItem">
                                        <option <c:if test="${doctorId==doctorItem.doctorId}">selected</c:if> value="${doctorItem.doctorId}">${doctorItem.doctorName}</option>
                                    </c:forEach>
                                </select><br/>
                            </td>
                             <td><spring:message code="lastTransactedBy(user)"/>:<br/> 
                                <select  name="userId"  id="userId" class="userInputLarge">
                                    <option value="0">All</option>
                                    <c:forEach items="${userList}" var="userItem">
                                        <option <c:if test="${userId==userItem.userId}">selected</c:if> value="${userItem.userId}">${userItem.username}</option>
                                    </c:forEach>
                                </select><br/>
                            </td>
                            <td style="padding:5px 5px 1px 5px;"><input  type="submit" value="Go" name="Go" style="margin:13px 0 0 0;" onclick="return yav.performCheck('form1', rules, 'inline');"/></td>
                    </tr>
                    </table>
                </form>
            </fieldset>
        </div>
    </body>
</html>
